Ext.namespace("MyApp.in_page.delete_row");

MyApp.in_page.delete_row.deleteRow = function (id, next) {
  var doNext = next;
  if(typeof next == "string") {
    doNext = function() {
      MyApp.common.goToNextPage(next);
    };
  }
  
  Ext.Msg.confirm("Confirm", "Are you sure you want to delete the row?", function(buttonId) {
    if(buttonId == 'yes') {
      var config = {
          method: "DELETE",
          url: restPath + "/in-page/delete-row/delete-row-data/" +encodeURIComponent(id),
          messageBeforeSuccessAction: (typeof next == "string")
      };
      MyApp.common.sendJsonRequestAndDoOnSuccess(config, doNext);
    }
  });
};
